#include <string.h>

void *memchr(const void *s, int c, size_t n) {
	const unsigned char *p;
	size_t x = 0;

	p = (const unsigned char *) s;
	while (x < n) {
		if (*p == (unsigned char) c)
			return ((void *) p);
		p++;
		x++;
	}
	return NULL;
}
